using System;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace flickr.api.communication
{
    [XmlRoot("rsp", Namespace="", IsNullable=false)]
    [Serializable]
    public class FlickrResponse 
    {
        [XmlElement("auth", Form=XmlSchemaForm.Unqualified)]
        public Auth Auth;

        [XmlElement("blogs", Form=XmlSchemaForm.Unqualified)]
        public Blogs Blogs;
//
//        [XmlElement("contacts", Form=XmlSchemaForm.Unqualified)]
//        public Contacts Contacts;

        [XmlElement("frob", Form=XmlSchemaForm.Unqualified)]
        public Frob Frob;

        [XmlElement("photos", Form=XmlSchemaForm.Unqualified)]
        public Photos Photos;

        [XmlElement("photo", Form=XmlSchemaForm.Unqualified)]
        public PhotoInfo Photo;

        [XmlElement("category", Form=XmlSchemaForm.Unqualified)]
        public Category Category;

        [XmlElement("activegroups", Form=XmlSchemaForm.Unqualified)]
        public Groups Groups;

//        [XmlElement("groups", Form=XmlSchemaForm.Unqualified)]
//        public PoolGroups PoolGroups;

        [XmlElement("group", Form = XmlSchemaForm.Unqualified)]
        public Group Group;

        [XmlElement("photocounts", Form=XmlSchemaForm.Unqualified)]
        public PhotoCounts PhotoCounts;

        [XmlElement("who", Form=XmlSchemaForm.Unqualified)]
        public WhoInfo Who;

        [XmlElement("tags", Form=XmlSchemaForm.Unqualified)]
        public PhotoInfoTags Tags;

        [XmlElement("perms", Form=XmlSchemaForm.Unqualified)]
        public PhotoPermissions PhotoPermissions;

        [XmlElement("user", Form=XmlSchemaForm.Unqualified)]
        public User User;
    
        [XmlElement("person", Form=XmlSchemaForm.Unqualified)]
        public Person Person;
    
        [XmlElement("photoset", Form=XmlSchemaForm.Unqualified)]
        public Photoset Photoset;

        [XmlElement("photosets", Form=XmlSchemaForm.Unqualified)]
        public Photosets Photosets;

        [XmlElement("online", Form=XmlSchemaForm.Unqualified)]
        public Online OnlineUsers;
      
        [XmlElement("licenses", Form=XmlSchemaForm.Unqualified)]
        public Licenses Licenses;
//
//        [XmlElement("count", Form=XmlSchemaForm.Unqualified)]
//        public ContextCount ContextCount;
//
//        [XmlElement("nextphoto", Form=XmlSchemaForm.Unqualified)]
//        public ContextPhoto ContextNextPhoto;
//
//        [XmlElement("prevphoto", Form=XmlSchemaForm.Unqualified)]
//        public ContextPhoto ContextPrevPhoto;

        [XmlAttribute("stat", Form=XmlSchemaForm.Unqualified)]
        public ResponseStatus Status;

        [XmlElement("err", Form=XmlSchemaForm.Unqualified)]
        public ResponseError Error;

        [XmlAnyElement()]
        public XmlElement[] AllElements;

        [XmlElement("sizes", Form=XmlSchemaForm.Unqualified)]
        public Sizes Sizes;
    }

    [Serializable]
    public class ResponseError
    {
        [XmlAttribute("code", Form=XmlSchemaForm.Unqualified)]
        public int Code;

        [XmlAttribute("msg", Form=XmlSchemaForm.Unqualified)]
        public string Message;
    }

    public enum ResponseStatus
    {
        [XmlEnum("ok")]
        OK,
        [XmlEnum("fail")]
        Failed
    }
}